﻿#ifndef PROGRESS_H
#define PROGRESS_H

#include "qbaseentity.h"

class Progress : public QBaseEntity
{
    Q_OBJECT
    // 使用 Q_PROPERTY 宏定义属性
    Q_PROPERTY(uint64_t id READ getId WRITE setId)
    Q_PROPERTY(QString path READ getPath WRITE setPath)
    Q_PROPERTY(QString name READ getName WRITE setName)
    Q_PROPERTY(bool vanish_up READ getVanish_up WRITE setVanish_up)
    Q_PROPERTY(bool cpu_use_up READ getCpu_use_up WRITE setCpu_use_up)
    Q_PROPERTY(int cpu_level READ getCpu_level WRITE setCpu_level)
    Q_PROPERTY(bool heartbeat_up READ getHeartbeat_up WRITE setHeartbeat_up)
    Q_PROPERTY(QString heartbeat_msg READ getHeartbeat_msg WRITE setHeartbeat_msg)
    Q_PROPERTY(int heartbeat_timeout_second READ getHeartbeat_timeout_second WRITE setHeartbeat_timeout_second)
    Q_PROPERTY(bool heartbeat_exit READ getHeartbeat_exit WRITE setHeartbeat_exit)
    Q_PROPERTY(bool init_start READ getInit_start WRITE setInit_start)
    Q_PROPERTY(int start_sleep READ getStart_sleep WRITE setStart_sleep)
    Q_PROPERTY(bool daemon_open READ getDaemon_open WRITE setDaemon_open)

public:
    explicit Progress(QObject *parent = nullptr);
    ~Progress();

    uint64_t getId() const;
    void setId(const uint64_t &value);

    QString getPath() const;
    void setPath(const QString &value);

    QString getName() const;
    void setName(const QString &value);

    bool getVanish_up() const;
    void setVanish_up(bool value);

    bool getCpu_use_up() const;
    void setCpu_use_up(bool value);

    int getCpu_level() const;
    void setCpu_level(int value);

    bool getHeartbeat_up() const;
    void setHeartbeat_up(bool value);

    QString getHeartbeat_msg() const;
    void setHeartbeat_msg(const QString &value);

    bool getHeartbeat_exit() const;
    void setHeartbeat_exit(bool value);

    bool getInit_start() const;
    void setInit_start(bool value);

    int getStart_sleep() const;
    void setStart_sleep(int value);

    bool getDaemon_open() const;
    void setDaemon_open(bool value);

    int getHeartbeat_timeout_second() const;
    void setHeartbeat_timeout_second(int value);

private:
    uint64_t id;
    QString path;                 //程序路径
    QString name;                 //程序名称
    bool vanish_up;               //进程消失拉起
    bool cpu_use_up;              //是否通过CPU占用拉起
    int cpu_level;                //CPU占用门限
    bool heartbeat_up;            //心跳守护
    QString heartbeat_msg;        //心跳守护地址
    int heartbeat_timeout_second; //心跳超时判决秒数
    bool heartbeat_exit;          //心跳主动退出
    bool init_start;              //开机启动
    int start_sleep;              //启动延时
    bool daemon_open;             //开启守护
    //public:
    //    QString generateUpdateSql() const override;
};
Q_DECLARE_METATYPE(Progress) //注册到元数据对象
#endif                       // PROGRESS_H
